package com.szxy.common.redis.service.impl;

import com.szxy.common.redis.service.ContentRedisService;
import com.szxy.utils.ContentAD;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther:zwer
 * @Date:2019/9/11 13:51
 * @Description:com.szxy.common.redis.service.impl
 * @Version:1.0
 **/
@Service
public class ContentRedisServiceImpl implements ContentRedisService {

    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    @Value("${REDIS_FRONT_AD_KEY}")
    private String REDIS_FRONT_AD_KEY;

    @Override
    public void insertContentAD(List<ContentAD> contentADList) {
        this.redisTemplate.opsForValue().set(this.REDIS_FRONT_AD_KEY,contentADList);
    }

    @Override
    public List<ContentAD> getItemCatResult() {
        return (List<ContentAD>) this.redisTemplate.opsForValue().get(this.REDIS_FRONT_AD_KEY);
    }
}
